    <?php
    require dirname(dirname(__FILE__)).'/abstract.php';
    
    class SF_Order_AutoCorrent extends Mage_Shell_Abstract
         {
             const CORRECT_MESSAGE_A ='Blending Success (->Pending)';
             const CORRECT_MESSAGE_B ='Blending Success (->Failure)';
             const CORRECT_MESSAGE_C ='Blending Success (->Success)';
             
             const CORRECT_MESSAGE_D ='Order does not exist';
             const CORRECT_MESSAGE_E ='Incomplete incoming parameters';
             const CORRECT_MESSAGE_F ='Order too much (only query up to 100)';
             const CORRECT_MESSAGE_G ='Merchant number or gateway access number does not exist';
             const CORRECT_MESSAGE_H ='signInfo encrypted information error';
             const CORRECT_MESSAGE_I ='Your server IP is not registered';
             const CORRECT_MESSAGE_L ='System abnormalities Or Select only one option';
             const CORRECT_MESSAGE_J ='the php.ini not open extension = php_soap.dll';
             const CORRECT_MESSAGE_K ='Please select your Correct orders';
            
             
			public function run(){
                  $this->autoCorrent();
            }
			 
			 
            public function autoCorrent(){
                 $day =  $this->getArg("day")?$this->getArg("day"):"2";
                
                 $collection = Mage::getModel('sales/order')->getCollection()
                 ->addFieldToFilter('status', array('eq'=>'pending'))
                 ->addFieldToFilter('created_at', array('datetime' => true, 'from'=>Mage::app()->getLocale()->date()->sub($day,Zend_Date::DAY)->toString('YYYY-MM-dd HH:mm:ss'),'to' => Mage::app()->getLocale()->date()->sub("0",Zend_Date::DAY)->toString('YYYY-MM-dd HH:mm:ss')));
                  
                 $orderData = $collection->getData();            
                 if(!$orderData){
					 $str = (string)$collection->getSelect();
					 
                     Mage::log("not found pending order!",1,"corrent.log");
                     exit;
                 }
                 foreach ($orderData as $v){
                     $orderIds[] =  $v['entity_id'];
                 }
             
               
                 foreach($orderIds as $orderId){
                     $id = $orderId;
             
                     $order = Mage::getModel('sales/order')->load($id);
             
                     $object=$order->getPayment()->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true);
    
                     $k = $object->method;  //获得支付方式
					Mage::log('支付方式',1,'corrent.log');             
					Mage::log($k,1,'corrent.log');
                     if(!empty($k)){
             
                         switch ($k)
                         {
                             case 'ebanx_payment':
                                 $model = Mage::getModel('ebanx/payment');
                                 $merNo     = $model->getConfigData('merchant_no');
                                 $gatewayNo = $model->getConfigData('gateway_no');
                                 $signkey   = $model->getConfigData('signkey_code');
                                 $signInfo  = hash('sha256',$merNo.$gatewayNo.$signkey);
                                 $ebanx_orderstr = $order->increment_id;
                                 $params=array(
                                     'merNo'=>$merNo,
                                     'gatewayNo'=>$gatewayNo,
                                     'orderNo'=>$ebanx_orderstr,
                                     'signInfo'=>$signInfo
                                 );
                                 $this->change_orderby_globebill($params,$k,$id);
                                 break;
                             case 'creditcard_payment':
                                 $model = Mage::getModel('creditcard/payment');
                                 $merNo     = $model->getConfigData('merchant_no');
                                 $gatewayNo = $model->getConfigData('gateway_no');
                                 $signkey   = $model->getConfigData('signkey_code');
                                 $signInfo  = hash('sha256',$merNo.$gatewayNo.$signkey);
                                 $creditcard_orderstr = $order->increment_id;
                                 $params=array(
                                     'merNo'=>$merNo,
                                     'gatewayNo'=>$gatewayNo,
                                     'orderNo'=>$creditcard_orderstr,
                                     'signInfo'=>$signInfo
                                 );
                                 $this->change_orderby_globebill($params,$k,$id);
                                 break;
                             case 'yandex_payment':
                                 $model = Mage::getModel('yandex/payment');
                                 $merNo     = $model->getConfigData('merchant_no');
                                 $gatewayNo = $model->getConfigData('gateway_no');
                                 $signkey   = $model->getConfigData('signkey_code');
                                 $signInfo  = hash('sha256',$merNo.$gatewayNo.$signkey);
                                 $yandex_orderstr = $order->increment_id;
                                 $params=array(
                                     'merNo'=>$merNo,
                                     'gatewayNo'=>$gatewayNo,
                                     'orderNo'=>$yandex_orderstr,
                                     'signInfo'=>$signInfo
                                 );
                                 $this->change_orderby_globebill($params,$k,$id);
                                 break;
                             case 'qiwi_payment':
                                 $model = Mage::getModel('qiwi/payment');
                                 $merNo     = $model->getConfigData('merchant_no');
                                 $gatewayNo = $model->getConfigData('gateway_no');
                                 $signkey   = $model->getConfigData('signkey_code');
                                 $signInfo  = hash('sha256',$merNo.$gatewayNo.$signkey);
                                 $qiwi_orderstr = $order->increment_id;
                                 $params=array(
                                     'merNo'=>$merNo,
                                     'gatewayNo'=>$gatewayNo,
                                     'orderNo'=>$qiwi_orderstr,
                                     'signInfo'=>$signInfo
                                 );
                                 $this->change_orderby_globebill($params,$k,$id);
                                 break;
							
							
							/*以下是钱海的model*/
							case 'oceanpayment_creditcard':
								$model = Mage::getModel('opcreditcard/payment');
								$merNo     = $model->getConfigData('account');
								$gatewayNo = $model->getConfigData('terminal');
								$signkey   = $model->getConfigData('securecode');
								$opcreditcard_order = $order->increment_id;
								$signInfo  = hash('sha256',$merNo.$gatewayNo.$opcreditcard_order.$signkey);
								
								$params=array(
										'account'=>$merNo,
										'terminal'=>$gatewayNo,
										'order_number'=>$opcreditcard_order,
										'signValue'=>$signInfo
								);
								$this->ocean_change_orderby_globebill($params,$k,$id);
								break;
							case 'oceanpayment_yandex':
								$model = Mage::getModel('opyandex/payment');
								$merNo     = $model->getConfigData('account');
								$gatewayNo = $model->getConfigData('terminal');
								$signkey   = $model->getConfigData('securecode');
								$opyandex_order = $order->increment_id;
								$signInfo  = hash('sha256',$merNo.$gatewayNo.$opyandex_order.$signkey);
								$params=array(
										'account'=>$merNo,
										'terminal'=>$gatewayNo,
										'order_number'=>$opyandex_order,
										'signValue'=>$signInfo
								);
								$this->ocean_change_orderby_globebill($params,$k,$id);
								break;
							case 'oceanpayment_qiwi':
								$model = Mage::getModel('opqiwi/payment');
								$merNo     = $model->getConfigData('account');
								$gatewayNo = $model->getConfigData('terminal');
								$signkey   = $model->getConfigData('securecode');
								$opqiwi_order = $order->increment_id;
								$signInfo  = hash('sha256',$merNo.$gatewayNo.$opqiwi_order.$signkey);
								$params=array(
										'account'=>$merNo,
										'terminal'=>$gatewayNo,
										'order_number'=>$opqiwi_order,
										'signValue'=>$signInfo
								);
								$this->ocean_change_orderby_globebill($params,$k,$id);
								break;
                         }
                     }
             
                     else{
                         $this->info[]=$this->__('There is no able to blending of payment.');
                         exit;
                     }
                 }
             }
             /*==================*
              *    Socket函数         *
              *==================*/
             function socketPost($url, $data)
             {
                 $url = parse_url($url);
                 if (!$url) return "couldn't parse url";
                 if (!isset($url['port'])) {
                     $url['port'] = "";
                 }
                 if (!isset($url['query'])) {
                     $url['query'] = "";
                 }
                 $encoded = "";
                 while (list($k,$v) = each($data)) {
                     $encoded .= ($encoded ? "&" : "");
                     $encoded .= rawurlencode($k)."=".rawurlencode($v);
                 }
                 $fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80);
                 if (!$fp) return "Failed to open socket to $url[host]";
             
                 fputs($fp, sprintf("POST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));
                 fputs($fp, "Host: $url[host]\n");
                 fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
                 fputs($fp, "Content-length: " . strlen($encoded) . "\n");
                 fputs($fp, "Connection: close\n\n");
             
                 fputs($fp, "$encoded\n");
             
                 $line = fgets($fp,1024);
                 if (!preg_match("/HTTP\/1\.\d (\d{3}) ([\w\d\s+]+)/", $line)) return;
             
                 $results = ""; $inheader = 1;
                 while(!feof($fp)) {
                     $line = fgets($fp,1024);
                     if ($inheader && ($line == "\n" || $line == "\r\n")) {
                         $inheader = 0;
                     }
                     elseif (!$inheader) {
                         $results .= $line;
                     }
                 }
                 fclose($fp);
                 return $results;
             }
                
             public function exceptionCorrent($massege){
                 throw Mage::exception('Mage_Core', Mage::helper('sales')->__($massege));
             }
             /**=====================================================*
              *                                                       *
              *              Globebill 勾兑程序(开始)                  *
              *                                                       *
              *======================================================*/
              
             /*==================*
              *   勾兑程序函数         *
              *==================*/
             public function change_orderby_globebill($params,$k,$id)
             {
                  
                 $correct_message = array(
                     '-2'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_A,
                     '-1'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_A,
                     '0'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_B,
                     '1'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_C,
                     '2'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_D,
                     '3'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_E,
                     '4'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_F,
                     '5'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_G,
                     '6'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_H,
                     '7'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_I,
                     '8'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_L);
                  
                  
                 $correct_error = array(
                     '0'=>self::CORRECT_MESSAGE_K,
                     '1'=>self::CORRECT_MESSAGE_J,
                     '2'=>"%s ".self::CORRECT_MESSAGE_D,
                     '3'=>"%s ".self::CORRECT_MESSAGE_E,
                     '4'=>"%s ".self::CORRECT_MESSAGE_F,
                     '5'=>"%s ".self::CORRECT_MESSAGE_G,
                     '6'=>"%s ".self::CORRECT_MESSAGE_H,
                     '7'=>"%s ".self::CORRECT_MESSAGE_I,
                     '8'=>"%s ".self::CORRECT_MESSAGE_L);
                  
                  
                 try {
                     // $result_data = $this->socketPost('https://processor.globebill.com/servlet/TestCustomerCheck',$params);
					 $result_data = $this->socketPost('https://processor.globebill.com/servlet/NormalCustomerCheck',$params);
                     $xml = new DOMDocument();
                     $xml->loadXML($result_data);
                      
                     $orderNo = $xml->getElementsByTagName("orderNo")->item(0)->nodeValue;
                     $tradeNo = $xml->getElementsByTagName("tradeNo")->item(0)->nodeValue;
                     $queryResult = $xml->getElementsByTagName("queryResult")->item(0)->nodeValue;
                     Mage::log('传参',1,"corrent.log");
					 Mage::log($params,1,"corrent.log");
                     Mage::log("返回报文",1,"corrent.log");
                     Mage::log($result_data,1,"corrent.log");
                     
                     $model='';
                     switch ($k)
                     {
                         case 'ebanx_payment':
                             $model = Mage::getModel('ebanx/payment');
                         case 'creditcard_payment':
                             $model = Mage::getModel('creditcard/payment');
                             break;
                         case 'yandex_payment':
                             $model = Mage::getModel('yandex/payment');
                             break;
                         case 'qiwi_payment':
                             $model = Mage::getModel('qiwi/payment');
                             break;
                     }
                      
                     $order = Mage::getModel('sales/order')->load($id);
                        
                      if($order->getStatus()=="payment_success"){
                          exit;
                      }
                      Mage::log("时间：".date('Y-m-d H:i:s'),1,"corrent.log");
                      Mage::log("订单号".$order->getIncrementId()."勾兑匹配项:".$queryResult,1,"corrent.log");
                      if(!isset($queryResult))exit;
                      
                      
                     switch ($queryResult)
                     {
                      
                         case -2:
                             Mage::log("order_configstatus:".$model->getConfigData('order_status'),1,"corrent.log");
                             Mage::log("order_status:".$order->getStatus(),1,"corrent.log");
                             //待确认
                             if($model->getConfigData('order_status')==$order->getStatus()){
                                 break;
                             }
                             
                             $order->addStatusToHistory($model->getConfigData('order_status'),Mage::helper('creditcard')->__('Correct Success!'));
                             $order->save();
                            $this->info=sprintf($correct_message['-2'],$k,$orderNo);
                             break;
                         case -1:
                             //待处理
                             Mage::log("order_configstatus:".$model->getConfigData('order_status'),1,"corrent.log");
                             Mage::log("order_status:".$order->getStatus(),1,"corrent.log");
                             if($model->getConfigData('order_status')==$order->getStatus()){
                                 break;
                             }
                             $order->addStatusToHistory($model->getConfigData('order_status'),Mage::helper('creditcard')->__('Correct Succeed!'));
                             $order->save();
                             $this->info=sprintf($correct_message['-1'],$k,$orderNo);
                             break;
                         case 0:
                             //失败
                             
							 Mage::log("订单号".$order->getIncrementId()."勾的兑失败状态修改:".$model->getConfigData('order_status_payment_refused'),1,"corrent.log");
                             $order->addStatusToHistory($model->getConfigData('order_status_payment_refused'),Mage::helper('creditcard')->__('Correct Succeed!'));
                             $order->save();
                            $this->info=sprintf($correct_message['0'],$k,$orderNo);
                             break;
                         case 1:
								Mage::log("订单号".$order->getIncrementId()."的勾兑成功状态修改:".$model->getConfigData('order_status_payment_accepted'),1,"corrent.log");
                             //成功
                             $order->addStatusToHistory($model->getConfigData('order_status_payment_accepted'),Mage::helper('creditcard')->__('Correct succeed!'));
                             $order->save();
                             $this->info=sprintf($correct_message['1'],$k,$orderNo);
                             break;
                         case 2:
							 Mage::log("订单号".$order->getIncrementId()."勾的兑失败状态修改:".$model->getConfigData('order_status_payment_refused'),1,"corrent.log");
							 $order->addStatusToHistory($model->getConfigData('order_status_payment_refused'),Mage::helper('creditcard')->__('Correct Succeed!'));
							 $order->save();
							 $this->info=sprintf($correct_message['2'],$k,$orderNo);
                             break;
                         case 3:
                             $this->exceptionCorrent(sprintf($correct_message['3'],$k,$orderNo));
                               sprintf($correct_message['3'],$k,$orderNo);
                             break;
                         case 4:
                             $this->exceptionCorrent(sprintf($correct_message['4'],$k,$orderNo));
                             break;
                         case 5:
                             $this->exceptionCorrent(sprintf($correct_message['5'],$k,$orderNo));
                             break;
                         case 6:
                             $this->exceptionCorrent(sprintf($correct_message['6'],$k,$orderNo));
                          
                             break;
                         case 7:
                             $this->exceptionCorrent(sprintf($correct_message['7'],$k,$orderNo));
                             break;
                         default:
                             $this->exceptionCorrent(sprintf($correct_message['8'],$k,$orderNo));
                             break;
                     }
                   echo $this->info . "\n";
                 } catch (SoapFault $fault){
                     Mage::log("Corrent_SoapFault");
                     Mage::log($fault->faultstring);
                 } catch(Mage_Core_Exception $e){
                     Mage::log("Corrent_error");
                     Mage::log($e->getMessage());
                 }     
             }

			/*钱海的勾兑方法*/
			public function ocean_change_orderby_globebill($params,$k,$id)
			{
			
				$correct_message = array(
						'-2'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_A,
						'-1'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_A,
						'0'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_B,
						'1'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_C,
						'2'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_D,
						'3'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_E,
						'4'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_F,
						'5'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_G,
						'6'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_H,
						'7'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_I,
						'8'=>"%s orderNo: %u ".self::CORRECT_MESSAGE_L);
			
			
				$correct_error = array(
						'0'=>self::CORRECT_MESSAGE_K,
						'1'=>self::CORRECT_MESSAGE_J,
						'2'=>"%s ".self::CORRECT_MESSAGE_D,
						'3'=>"%s ".self::CORRECT_MESSAGE_E,
						'4'=>"%s ".self::CORRECT_MESSAGE_F,
						'5'=>"%s ".self::CORRECT_MESSAGE_G,
						'6'=>"%s ".self::CORRECT_MESSAGE_H,
						'7'=>"%s ".self::CORRECT_MESSAGE_I,
						'8'=>"%s ".self::CORRECT_MESSAGE_L);
			
			
				try {
					// $url = 'https://query.oceanpayment.com/service/check/test';
					$url = 'https://query.oceanpayment.com/service/check/normal';
					
					$model='';
					switch ($k)
					{
						case 'oceanpayment_yandex':
							$model = Mage::getModel('opyandex/payment');
							$result_data = $this->oceanSocketPost($url,$params);
							break;
						case 'oceanpayment_creditcard':
							$model = Mage::getModel('opcreditcard/payment');
							$result_data = $this->oceanSocketPost($url,$params);
							break;
						case 'oceanpayment_qiwi':
							$model = Mage::getModel('opqiwi/payment');
							$result_data = $this->oceanSocketPost($url,$params);
							break;
					}
					
					
					
					$xml = new DOMDocument();
					$xml->loadXML($result_data);
								
					$orderNo = $xml->getElementsByTagName("order_number")->item(0)->nodeValue;
					$tradeNo = $xml->getElementsByTagName("payment_id")->item(0)->nodeValue;
					$queryResult = $xml->getElementsByTagName("payment_results")->item(0)->nodeValue;

					Mage::log('传参',1,"corrent.log");
					Mage::log($params,1,"corrent.log");
					Mage::log("返回报文",1,"corrent.log");
					Mage::log($result_data,1,"corrent.log");
							 
			
					$order = Mage::getModel('sales/order')->load($id);

					switch ($queryResult)
                     {
                      
                         case -2:
                             Mage::log("order_configstatus:".$model->getConfigData('order_status'),1,"corrent.log");
                             Mage::log("order_status:".$order->getStatus(),1,"corrent.log");
                             //待确认
                             if($model->getConfigData('order_status')==$order->getStatus()){
                                 break;
                             }
                             
                             $order->addStatusToHistory($model->getConfigData('order_status'),Mage::helper('creditcard')->__('Correct Success!'));
                             $order->save();
                            $this->info=sprintf($correct_message['-2'],$k,$orderNo);
                             break;
                         case -1:
                             //待处理
                             Mage::log("order_configstatus:".$model->getConfigData('order_status'),1,"corrent.log");
                             Mage::log("order_status:".$order->getStatus(),1,"corrent.log");
                             if($model->getConfigData('order_status')==$order->getStatus()){
                                 break;
                             }
                             $order->addStatusToHistory($model->getConfigData('order_status'),Mage::helper('creditcard')->__('Correct Succeed!'));
                             $order->save();
                             $this->info=sprintf($correct_message['-1'],$k,$orderNo);
                             break;
                         case 0:
                             //失败
                             
							 Mage::log("订单号".$order->getIncrementId()."勾的兑失败状态修改:".$model->getConfigData('order_status_payment_refused'),1,"corrent.log");
                             $order->addStatusToHistory($model->getConfigData('order_status_payment_refused'),Mage::helper('creditcard')->__('Correct Succeed!'));
                             $order->save();
                            $this->info=sprintf($correct_message['0'],$k,$orderNo);
                             break;
                         case 1:
								Mage::log("订单号".$order->getIncrementId()."的勾兑成功状态修改:".$model->getConfigData('order_status_payment_accepted'),1,"corrent.log");
                             //成功
                             $order->addStatusToHistory($model->getConfigData('order_status_payment_accepted'),Mage::helper('creditcard')->__('Correct succeed!'));
                             $order->save();
                             $this->info=sprintf($correct_message['1'],$k,$orderNo);
                             break;
                         case 2:
							 Mage::log("订单号".$order->getIncrementId()."勾的兑失败状态修改:".$model->getConfigData('order_status_payment_refused'),1,"corrent.log");
							 $order->addStatusToHistory($model->getConfigData('order_status_payment_refused'),Mage::helper('creditcard')->__('Correct Succeed!'));
							 $order->save();
							 $this->info=sprintf($correct_message['2'],$k,$orderNo);
                             break;
                         case 3:
                             $this->exceptionCorrent(sprintf($correct_message['3'],$k,$orderNo));
                               sprintf($correct_message['3'],$k,$orderNo);
                             break;
                         case 4:
                             $this->exceptionCorrent(sprintf($correct_message['4'],$k,$orderNo));
                             break;
                         case 5:
                             $this->exceptionCorrent(sprintf($correct_message['5'],$k,$orderNo));
                             break;
                         case 6:
                             $this->exceptionCorrent(sprintf($correct_message['6'],$k,$orderNo));
                          
                             break;
                         case 7:
                             $this->exceptionCorrent(sprintf($correct_message['7'],$k,$orderNo));
                             break;
                         default:
                             $this->exceptionCorrent(sprintf($correct_message['8'],$k,$orderNo));
                             break;
                     }
                   echo $this->info . "\n";
                 } catch (SoapFault $fault){
                     Mage::log("Corrent_SoapFault");
                     Mage::log($fault->faultstring);
                 } catch(Mage_Core_Exception $e){
                     Mage::log("Corrent_error");
                     Mage::log($e->getMessage());
                 }
			
			}
						
			/*==================*
			 *    Socket函数         *
			*==================*/

			/*钱海勾兑方法*/
			function oceanSocketPost($url, $data)
			{
				$url = parse_url($url);

				if (!$url) return "couldn't parse url";
				if (!isset($url['port'])) {
					$url['port'] = "";
				}
				if (!isset($url['query'])) {
					$url['query'] = "";
				}
				$encoded = "";
				while (list($k,$v) = each($data)) {
					$encoded .= ($encoded ? "&" : "");
					$encoded .= rawurlencode($k)."=".rawurlencode($v);
				}

				$fp = fsockopen('ssl://'.$url['host'], 443, $errno, $errstr);
				if (!$fp) return "Failed to open socket to $url[host] $port ERROR: $errno - $errstr";

				fputs($fp, sprintf("POST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));
				fputs($fp, "Host: $url[host]\n");
				fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
				fputs($fp, "Content-length: " . strlen($encoded) . "\n");
				fputs($fp, "Connection: close\n\n");

				fputs($fp, "$encoded\n");

				$line = fgets($fp,1024);
				if (!preg_match("/HTTP\/1\.\d (\d{3}) ([\w\d\s+]+)/", $line)) return;

				$results = ""; $inheader = 1;
				while(!feof($fp)) {
					$line = fgets($fp,1024);
					if ($inheader && ($line == "\n" || $line == "\r\n")) {
						$inheader = 0;
					}
					elseif (!$inheader) {
						$results .= $line;
					}
				}
				fclose($fp);
				return $results;
			}
			 
         }
		 
		 
		 
		/*自动运行*/
		$test = new SF_Order_AutoCorrent();
		$test->run();
         
